const multer = require('multer')
const md5 = require('md5')
const storage = multer.diskStorage({
  destination: (req, file, cb) => {
    cb(null, './upload')
  },
  filename: (req, file, cb) => {
    cb(null, md5(Date.now()) + '.' + file.mimetype.split('/')[1])
  }
})
const upload = multer({ storage })

module.exports = upload
